package com.ruoyi.pm.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.pubfun.IdWorker;
import com.ruoyi.pm.domain.SaasSupplierRequest;
import com.ruoyi.pm.mapper.SaasSupplierRequestMapper;
import com.ruoyi.pm.service.ISaasSupplierRequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 保司自定义请求方法Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-01-20
 */
@Service
public class SaasSupplierRequestServiceImpl implements ISaasSupplierRequestService 
{
    @Autowired
    private SaasSupplierRequestMapper saasSupplierRequestMapper;

    /**
     * 查询保司自定义请求方法
     * 
     * @param id 保司自定义请求方法主键
     * @return 保司自定义请求方法
     */
    @Override
    public SaasSupplierRequest selectSaasSupplierRequestById(Long id)
    {
        return saasSupplierRequestMapper.selectSaasSupplierRequestById(id);
    }

    /**
     * 查询保司自定义请求方法列表
     * 
     * @param saasSupplierRequest 保司自定义请求方法
     * @return 保司自定义请求方法
     */
    @Override
    public List<SaasSupplierRequest> selectSaasSupplierRequestList(SaasSupplierRequest saasSupplierRequest)
    {
        return saasSupplierRequestMapper.selectSaasSupplierRequestList(saasSupplierRequest);
    }

    /**
     * 查询保司自定义加密方法及系统方法
     *
     * @param supplierId 保司Id
     * @return 保司自定义请求方法集合
     */
    @Override
    public List<SaasSupplierRequest> listBySupplierId(Long supplierId){
        return saasSupplierRequestMapper.listBySupplierId(supplierId);
    }

    /**
     * 新增保司自定义请求方法
     * 
     * @param saasSupplierRequest 保司自定义请求方法
     * @return 结果
     */
    @Override
    public int insertSaasSupplierRequest(SaasSupplierRequest saasSupplierRequest)
    {
        saasSupplierRequest.setId(IdWorker.getId());
        saasSupplierRequest.setCreateBy(SecurityUtils.getUsername());
        saasSupplierRequest.setCreateTime(DateUtils.getNowDate());
        saasSupplierRequest.setUpdateBy(SecurityUtils.getUsername());
        saasSupplierRequest.setUpdateTime(DateUtils.getNowDate());
        return saasSupplierRequestMapper.insertSaasSupplierRequest(saasSupplierRequest);
    }

    /**
     * 修改保司自定义请求方法
     * 
     * @param saasSupplierRequest 保司自定义请求方法
     * @return 结果
     */
    @Override
    public int updateSaasSupplierRequest(SaasSupplierRequest saasSupplierRequest)
    {
        saasSupplierRequest.setUpdateBy(SecurityUtils.getUsername());
        saasSupplierRequest.setUpdateTime(DateUtils.getNowDate());
        return saasSupplierRequestMapper.updateSaasSupplierRequest(saasSupplierRequest);
    }

    /**
     * 批量删除保司自定义请求方法
     * 
     * @param ids 需要删除的保司自定义请求方法主键
     * @return 结果
     */
    @Override
    public int deleteSaasSupplierRequestByIds(Long[] ids)
    {
        return saasSupplierRequestMapper.deleteSaasSupplierRequestByIds(ids);
    }

    /**
     * 批量删除保司自定义请求方法
     *
     * @param supplierIds 保司Id集合
     * @return 结果
     */
    @Override
    public int deleteSaasSupplierRequestBySupplierIds(Long[] supplierIds){
        return saasSupplierRequestMapper.deleteSaasSupplierRequestBySupplierIds(supplierIds);
    }

    /**
     * 删除保司自定义请求方法信息
     * 
     * @param id 保司自定义请求方法主键
     * @return 结果
     */
    @Override
    public int deleteSaasSupplierRequestById(Long id)
    {
        return saasSupplierRequestMapper.deleteSaasSupplierRequestById(id);
    }
}
